﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using XamlDom.Runtime;

namespace XamlDomTest
{
    [TestClass]
    public class RuntimeFixture
    {
        [TestMethod]
        public void CreateObject()
        {
            var stackPanel = ClrObjectRuntime.Instance.CreateInstance(typeof(StackPanel), null);

            Assert.IsNotNull(stackPanel);
        }

        [TestMethod]
        public void SetPropertyTest()
        {
            StackPanel officalStackPanel = new StackPanel();
            officalStackPanel.Orientation = Orientation.Horizontal;

            var type = typeof(StackPanel);
            var customStackPanel = ClrObjectRuntime.Instance.CreateInstance(type, null);
            ClrObjectRuntime.Instance.SetPropertyValue(customStackPanel, "Orientation", "Horizontal");

            Assert.IsNotNull(officalStackPanel);
            Assert.IsNotNull(customStackPanel);
        }
    }
}
